Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development


Creating a custom super procedure for the browser

Next, you must activate the custom super procedure that extends the browser class. Copy the file src/adm2/custom/browsercustom.i to a local directory with the same relative pathname, and edit it to remove the comments around the start-super-proc statement that starts browsercustom.p, as shown:

/* ***************************  Main Block  *************************** */ 
/* Starts here the custom super procedure  
   Uncomment to run it */ 
    
RUN start-super-proc ("adm2/custom/browsercustom.p":U). 

Add the supporting code for the pop-up menu. Copy the file src/adm2/custom/browsercustom.p to a local directory with the same relative path. The remainder of this section highlights key parts of the code that must be added to the super procedure. A complete version of the code is available in the browsercustom_popup.p file that accompanies this documentation. You can refer to this procedure for more code details and run it (after renaming it, of course) to try out the feature.

The first requirement is that there must be functions that support getting and setting the two new properties you just defined. As we noted, the xp preprocessors you defined allow code within the super procedure itself, or in other super procedures in the browser support code, to access the property directly in the property temp-table record for the object. This is done using the {get} and {set} include files that you’ve seen elsewhere in this documentation. The include files access the property without using a function call, which is a small optimization.

But other objects cannot use this convention because they do not have access to the temp-table record directly. So you must define get and set functions for every property that should be retrievable or settable from outside the object itself and its supporting code.

The form of these functions is simple. The following code sample is the get function for the BrowsePopupActive property:

FUNCTION getBrowsePopupActive RETURNS LOGICAL 
  ( ) : 
/*------------------------------------------------------------------------- 
  Purpose:  Returns the value of the BrowsePopupActive property. 
-------------------------------------------------------------------------*/ 
    DEFINE VARIABLE lActive AS LOGICAL    NO-UNDO. 
    {get BrowsePopupActive lActive}. 
    RETURN lActive. 
END FUNCTION. 

As you can see, it simply turns around and accesses the property via the {get} include file, which is available to it because it is within the class hierarchy for the object, where the include files can be used. The set property function is similar, as shown:

FUNCTION setBrowsePopupActive RETURNS LOGICAL 
  ( INPUT plActive AS LOGICAL ): 
/*------------------------------------------------------------------------- 
  Purpose:  Sets the BrowsePopupActive property. 
-------------------------------------------------------------------------*/ 
    {set BrowsePopupActive plActive}. 
    RETURN TRUE. 
END FUNCTION. 

You need equivalent functions for the BrowseColumnsMovable property as well.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095